import React, { Component } from 'react'

export default class App extends Component {
	state = {
		count: 0
	}
	handelClick() {
		// this指向实例对象
		// console.log(this.state.count)
		return () => {
			// 箭头函数没有自己的this,会向外部找, this指向外部,也指向实例对象
			console.log(this.state.count)
		}
	}
	render() {
		return (
			<div style={{ textAlign: 'center' }}>
				<h2>计数器:{this.state.count}</h2>
				<button onClick={this.handelClick()}>+1</button>
			</div>
		)
	}
}
